﻿@inherits FeedbackComponent<int, bool>

<Row Justify="space-between" Style="margin-bottom:20px;">
    <Col Span="8" Style="text-align:right;"><label class="ant-form-item-required">部门：</label></Col>
    <Col Span="16"><Cascader Size="large" Options="@_deptCascaderNodes" @bind-Value="_deptCascaderValue" ExpandTrigger="hover" ChangeOnSelect SelectedNodesChanged="CascaderOnChange" Style="width:100%"></Cascader></Col>
</Row>

<Form Loading="@_formIsLoading"
      Model="@_editModel"
      LabelCol="new ColLayoutParam { Span = 8 }"
      WrapperCol="new ColLayoutParam { Span = 16 }"
      OnFinish="OnFormFinish"
      Context="model">
    @if (model.Id > 0)
    {
    <FormItem Label="头像">
        <Tooltip Placement="PlacementType.LeftTop" Title="@("点击修改头像")">
            <a @onclick="_ => OnAvatarClick(model)">
                <Avatar Src="@model.Avatar" />
            </a>
        </Tooltip>
    </FormItem>
    }
    <FormItem Label="用户名">
        <Input @bind-Value="@model.UserName" />
    </FormItem>
    <FormItem Label="密码">
        <Input Type="password" @bind-Value="@model.Password" />
    </FormItem>
    <FormItem Label="昵称">
        <Input @bind-Value="@model.NickName" />
    </FormItem>
    <FormItem Label="性别">
        <RadioGroup @bind-Value="@(model.Gender)">
            @foreach (var gitem in EnumExtension.EnumToDictionary<Gender>())
            {
                <Radio Value="@(gitem.Key)">@gitem.Value</Radio>
            }
        </RadioGroup>
    </FormItem>
    <FormItem Label="是否锁定">
        <Switch @bind-Value="@model.IsLocked"></Switch>
    </FormItem>
    <Divider Orientation="left" Style="font-weight:bold">联系信息</Divider>
    <FormItem Label="手机号">
        <Input @bind-Value="@model.PhoneNumber" />
    </FormItem>
    <FormItem Label="手机号是否确认">
        <Switch @bind-Value="@model.PhoneNumberConfirmed"></Switch>
    </FormItem>
    <FormItem Label="邮箱">
        <Input @bind-Value="@model.Email" />
    </FormItem>
    <FormItem Label="邮箱是否确认">
        <Switch @bind-Value="@model.EmailConfirmed"></Switch>
    </FormItem>
    <FormItem Label="QQ">
        <Input @bind-Value="@model.UserExtension.QQ" />
    </FormItem>
    <FormItem Label="微信">
        <Input @bind-Value="@model.UserExtension.WeChat" />
    </FormItem>
    <FormItem WrapperCol="new ColLayoutParam { Offset = 4, Span = 20 }">
        <Button Type="@ButtonType.Primary" HtmlType="submit">
            保存
        </Button>
        <Button OnClick="OnFormCancel">
            取消
        </Button>
    </FormItem>
</Form>